BE, Inc. T i m e S t a c k (TM) Version 1.10 The Ultimate Software Timing and Stack Analysis Utility April 1, 1993 _______ ____|__ | (R) --| | |------------------- | ____|__ | Association of | | |_| Shareware |__| o | Professionals -----| | |--------------------- |___|___| MEMBER "We provide answers you never had before" TimeStack User's Guide Copyright 1993 by BE, Inc. All Rights Reserved The information in this document is subject to change without notice and does not represent a commitment on the part of BE, Inc. BE, INC. MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. BE, INC. SHALL NOT BE LIABLE FOR ERRORS CONTAINED HEREIN OR FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE PERFORMANCE OF SERVICES USING THIS MATERIAL. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH THE USER., INCLUDING BUT NOT LIMITED TO LOSS OF PROFIT, AND SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER SIMILAR CLAIMS. U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. All BE, Inc. products are trademarks or registered trademarks of BE, Inc. Other brand and product names are trademarks or registered trademarks of their respective holders. BE, Inc. P.O. Box 29419 Indianapolis, IN 46229-0419 TimeStack User's Guide Table Of Contents Table Of Contents Table Of Contents i Introduction 1 Welcome to TimeStack.......................................1 What Is TimeStack..........................................1 Why TimeStack Is Unique....................................2 What TimeStack Does Not Do.................................2 The User's Guide...........................................2 Definition Of Shareware....................................3 The Association of Shareware Professionals (ASP)...........4 Registration Information...................................4 How To Contact BE, Inc.....................................5 Chapter One - Starting Up 6 System Requirements........................................6 Installation...............................................6 Configuring AUTOEXEC.BAT..............................7 Command Line Syntax........................................7 Loading and Running TimeStack..............................8 Chapter Two - Menus and Windows 9 Screen Layout..............................................9 Menus.....................................................10 How the menu works...................................10 Status line..........................................11 Entering filenames or text...........................11 Entering numbers and addresses.......................12 Menu Selections...........................................13 File.................................................13 Load............................................13 Restore.........................................13 i TimeStack User's Guide Table Of Contents Save............................................13 Get.............................................14 Put.............................................14 Analysis.............................................14 Edit.................................................15 Conditional branches............................15 Jump to subroutine..............................15 Jump indirect...................................16 Clear................................................16 Disasm...............................................16 Options..............................................16 Type of processor...............................16 Clock rate......................................16 Divisor for clock...............................17 Get.............................................17 1. Config.......................................17 2. Node.........................................17 Print................................................17 Comment.........................................18 1. Path to File.................................18 2. Disasm to File...............................18 3. Path to Printer..............................18 4. Disasm to Printer............................18 Quit.................................................19 Windows...................................................19 Selecting a window...................................19 Moving and sizing a window...........................19 Display of subroutines...............................20 Windows Displayed.........................................20 1 - Special Nodes....................................20 2 - Disassembly......................................20 3 - Analysis Results.................................21 4 - Maximum Execution................................21 5 - Minimum Execution................................22 6 - Stack Depth......................................22 Special Keys..............................................22 Function keys........................................22 Hot keys.............................................23 Other keys...........................................23 On-Line Help..............................................24 Chapter Three - Understanding TimeStack 25 Assembly Language Formats.................................25 Differences in mnemonics.............................26 Demo program limitations.............................27 Hex Files.................................................27 Motorola hex files...................................28 Intel hex files......................................28 Possible errors......................................29 Program Listings..........................................29 Configuration Files.......................................29 ii TimeStack User's Guide Table Of Contents Node Files................................................30 Temporary Files...........................................30 Start and Stop Addresses..................................30 Timing Concepts...........................................31 Conditional Branches......................................31 Take.................................................31 Fall.................................................32 Normal...............................................32 Program Loops.............................................32 Subroutines...............................................34 Jump Indirect.............................................35 Stack Depth...............................................35 Chapter Four - Tutorial 36 Look at Listing...........................................36 Invoking Program..........................................36 Configuring TimeStack.....................................37 Load the Hex File.........................................37 Timing Subroutines........................................38 Timing Subroutines with Conditional Branches..............39 Timing Loops..............................................41 Simple loop..........................................41 Loop with middle exit................................42 Printing the Results......................................43 Quitting the Program......................................44 Chapter Five - Timing Strategies 45 Have a Listing Ready......................................45 What Units to Use.........................................45 Start Small...............................................45 Be Realistic..............................................46 More Than One Path........................................47 Chapter Six - Advanced Tutorial 48 Invoke Program Again......................................48 Complex Loops.............................................48 Indirect Jump.............................................50 Untimeable Instructions...................................51 Illegal Instructions......................................51 Nested Loops..............................................52 Loops inside subroutines.............................52 Loops inside other loops.............................54 Subroutines with Different Execution Times................55 Stack Imbalance...........................................56 Infinite Loops............................................57 Memory limitations...................................58 Branch Past Stop Address..................................58 Actual Stop Address.......................................59 Forcing Conditional Branches..............................60 Save to File..............................................60 High Level Languages......................................60 iii TimeStack User's Guide Table Of Contents Appendix A - Listing of Demo Program 61 Appendix B - Warning and Error Messages 69 Warning Messages..........................................69 Error Messages............................................70 Appendix C - Key Summary 74 Appendix D - Processor Specifics 76 TSDEMO....................................................76 TS6811....................................................77 TS6805....................................................78 TS8051....................................................79 TS8048....................................................80 Index 81 iv TimeStack User's Guide Introduction Introduction Welcome to TimeStack Thank you for your purchase of TimeStack. Your days of counting opcode cycles and looking for instructions that push data on the stack are over. You will now be able to quickly document exactly how long an assembly language function takes to execute, find its worst stack depth usage, and check for stack imbalances! What Is TimeStack TimeStack is a better way to time and analyze your real-time assembly language programs. It is beneficial in real-time assembly language programs to know four things. * The absolute theoretical maximum execution time, * minimum execution time, * worst stack depth, and * stack imbalances. It is also beneficial to see how these paths were achieved. This allows proving that a program will execute within its limitations. TimeStack gives you this information. 1 TimeStack User's Guide Introduction Why TimeStack Is Unique Until now, execution time and stack depth had to be calculated by hand. TimeStack eliminates this drudgery. Using a simulator to verify timing is much harder than using it to do a functional test of a program. It is a long and tedious task to configure the inputs of a simulator to time the path that is thought to be the longest executing. TimeStack is better than a simulator for timings because all possible combinations of branches are examined. Some of the features that make TimeStack easy to use are pull down menus, hot keys, and multiple windows for display of information. It includes the ability to disassemble, send the results of the analysis to a printer or file, and save its current configuration. What TimeStack Does Not Do TimeStack is not a simulator. If the program contains a loop, the user will need to assist TimeStack by indicating how many times the loop takes place. It does not know what has been loaded into processor registers. If a portion of the logic has special considerations based on a register or flag value (loop counters, indirect jumps, etc.,) they must be specified by the user. The User's Guide The User's Guide provides all of the information about TimeStack as well as examples. Chapter One - Starting Up tells you how to install TimeStack on your system. Chapter Two - Menus and Windows describes the screen layout and how to work the menu system. Chapter Three - Understanding TimeStack goes into some background on what TimeStack needs to run and concepts involved with timing a program. 2 TimeStack User's Guide Introduction Chapter Four - Tutorial is an actual demonstration of how to analyze a simple program. Many of the concepts are shown. Chapter Five - Timing Strategies discusses some of the things to keep in mind while timing. Chapter Six - Advanced Tutorial expands on the demonstration by addressing more advanced topics. Appendix A - Listing of Demo Program is the complete listing of the demonstration program used in the examples. Appendix B - Warning and Error Messages lists and explains all warning and error messages that may be encountered, and suggests possible solutions. Appendix C - Key Summary is a convenient reference for all function keys and hot keys. Appendix D - Processor Specifics describes any special characteristics an individual processor may have. Definition Of Shareware TimeStack is a copyrighted program which is being marketed as shareware. It is not a public domain program and it is not free. Shareware is a distribution method, not a type of software. The shareware system makes fitting your needs easier, because you can try before you buy. Shareware has the ultimate money-back guarantee - if you don't use the product, you don't pay for it. Copyright laws apply to both shareware and commercial software, and the copyright holder retains all rights, with a few specific exceptions as stated later. Shareware authors are accomplished programmers and the programs are comparable in quality to commercial software (in both cases, there are good programs and bad ones). The main difference is in the method of distribution. The author specifically grants the right to copy and distribute the software, either to all and sundry or to a specific group. For example, some authors require written permission before a commercial disk vendor may copy their shareware. 3 TimeStack User's Guide Introduction The Association of Shareware Professionals (ASP) The ASP is an association for shareware authors with the general goals of educating shareware authors and distributors and the public, setting standards, sharing resources and information among members. Shareware produced by ASP members must meet minimum quality standards. The program must be fully functional, not crippled, a demo, or out-of-date version. The documentation must be complete and clearly state the registration fee and the benefits of registering. ASP members must provide free mail or telephone support for a minimum of three months after registration. Also, members must follow other guidelines to insure that a user is dealt with professionally. BE, Inc. is a member of the Association of Shareware Professionals (ASP). ASP wants to make sure that the shareware principle works for you. If you are unable to resolve a shareware-related problem with an ASP member by contacting the member directly, ASP may be able to help. The ASP Ombudsman can help you resolve a dispute or problem with an ASP member, but does not provide technical support for members' products. Please write to the ASP Ombudsman at 545 Grover Road, Muskegon, MI 49442 or send a CompuServe message via CompuServe Mail to ASP Ombudsman 70007,3536. Registration Information TimeStack is provided at no charge to the user for evaluation. Feel free to share it with your friends, but do not give it away altered or as part of another system. The essence of "user-supported" software is to provide personal computer users with quality software without high prices, and yet to provide incentive for programmers to continue to develop new products. BE, Inc. grants you a limited license to use TimeStack for evaluation purposes only for a period not to exceed 30 days. If you intend to continue using TimeStack or its documentation after the 30-day evaluation period, you MUST make a registration payment to BE, Inc. Using TimeStack after the evaluation period has ended without registering is a violation of this limited license. TimeStack may be registered by using the accompanying order form. You may also register using MasterCard or 4 TimeStack User's Guide Introduction Visa by phone (1-800-628-9085). Site licenses and volume discount arrangements may be made by contacting BE, Inc. Company purchase orders are welcomed. The $129.95 registration fee will license one copy for use on any one computer at any one time. Additional sites or additional computers on a local area network must be licensed separately. If you have any questions please contact BE, Inc. Registered users will receive: * The complete TimeStack package including typeset manual. * The most current version of TimeStack. BE, Inc. is continuously improving its products and registration ensures that you have the latest version. * Free technical support. * Notification of significant upgrades to TimeStack. How To Contact BE, Inc. When you register your software, you allow us to give you the kind of support you deserve. You may contact us by mail, by telephone, or on CompuServe. BE, Inc. P.O. Box 29419 Indianapolis, IN 46229-0419 (317) 894-7021 1-800-628-9085 (orders only) CompuServe [70353,2665] 5 TimeStack User's Guide Chapter One - Starting Up Chapter One - Starting Up System Requirements TimeStack requires the following system configuration: * IBM Personal Computer or a compatible, * at least 512K of RAM, * DOS Version 2.1 or greater, * a hard disk drive or floppy disk drive, and * IBM PC compatible video adapter. For fastest operation, a computer of at least an IBM-AT class machine is preferred. Of course, TimeStack will work with lesser models, but with a degradation in operating speed. Installation Before you install TimeStack, please read the information in the README file. The README file contains any last minute information that is not contained in this manual. Installation is fairly simple. All of the files on the TimeStack Program disk(s) are copied to a subdirectory on a hard disk or copied to a separate floppy disk. 6 TimeStack User's Guide Chapter One - Starting Up * Prepare the destination that is to receive the TimeStack files. This could be another floppy disk or a subdirectory on the hard disk. * Insert the TimeStack Program disk to be installed into the floppy disk drive. * Copy all the files from the TimeStack Program disk to the desired destination. The commands usually look like this: MD C:\TS COPY A:*.* C:\TS * Do this for each disk that is to be installed. The TimeStack files are not sensitive to the directory that they are placed. Configuring AUTOEXEC.BAT At the end of installation, you may find it convenient to have DOS automatically search the directory that contains the TimeStack files. DOS searches for a file called AUTOEXEC.BAT when you start your computer. It performs any commands that you might place in it. One useful command is PATH. It tells DOS which directories to search for executable commands after it has searched the current working directory. The command to have it search the TimeStack directory just created might look something like this: PATH C:\TS If there are other directories already specified in the PATH command, the TimeStack directory should be placed at the end. A semicolon separates each directory specified in the list: PATH C:\DOS;C:\BIN;C:\TS Command Line Syntax The name of the executable program that is typed at the command line is different for each family of processors. The generic command-line syntax for running TimeStack is: TSxxxx 7 TimeStack User's Guide Chapter One - Starting Up where xxxx is the name of the processor family. Currently, the valid program names are: * TSDEMO Demonstration program * TS6811 Motorola 6800/1/2/3 and 68HC11 families * TS6805 Motorola 6805 HMOS, HCMOS, and CMOS families * TS8051 Intel 8051 families * TS8048 Intel 8020/1 and 8048 families Loading and Running TimeStack If you are using a hard disk system, change to the directory where the TimeStack files are located. Type the program name at the DOS prompt and press Enter. If you are operating from a floppy system, place the TimeStack disk in the drive, change the current default drive to that drive, type the program name, and press Enter. 8 TimeStack User's Guide Chapter Two - Menus and Windows Chapter Two - Menus and Windows Screen Layout The screen as displayed in its default configuration has two major parts. The single line at the top is the main menu command bar. It is used to select the many different functions and includes a one-line help message about the currently selected item in a status line at the bottom. The rest of the screen contains the display windows with analysis information (see Figure 2-1). 9 TimeStack User's Guide Chapter Two - Menus and Windows File Analysis Edit Clear Disasm Options Print Quit ____+----------------------------+________+------- 3 - Analysis Results -------+ ____| Start address : 002F |________| 68DEMO at 1 MHz / 4 | ____| Stop address : FFFF |________| 002F to 0043 Bytes 21 | ____+----------------------------+________| Stack now -2 max 0 | +---------- 1 - Special Nodes -----------+| Cycle min 16 max 26 | | No special nodes || 64.0 us 104.0 us | | || | | |+------------------------------------+ | |+------ 4 - Maximum Execution -------+ | || 1) 0030 : BCC 0038 FALL | | || 2) 0036 : BCC 003D TAKE | | || 3) 003E : BCC 0043 FALL | | |+------------------------------------+ +----------------------------------------++------ 5 - Minimum Execution -------+ +----------- 2 - Disassembly ------------+| 1) 0030 : BCC 0038 TAKE | | No Disasm address entered || | | || | | |+------------------------------------+ | |+--------- 6 - Stack Depth ----------+ | || 1) 0030 : BCC 0038 FALL | | || 2) 0036 : BCC 003D FALL | | || | +----------------------------------------++------------------------------------+ Analyze program from start to stop address Figure 2-1 Typical screen Menus The pull down menus are selected by using the cursor keys and pressing Enter. Another method is to press the first letter of the menu description. How the menu works The TimeStack menu operates very much like most other popular menus. Pressing Esc aborts the current operation and backs up one level in the menu. Thus, pressing Esc a multiple number of times will eventually return the cursor to the main menu. The left and right arrow keys are used to move the highlight bar back and forth along the menu line. 10 TimeStack User's Guide Chapter Two - Menus and Windows Pressing Enter selects the menu item and pulls down the next menu or invokes whatever action should take place. On the pull down menus, pressing the up and down arrow keys moves the highlight bar through the selections. Pressing Enter selects the menu item or invokes whatever action should take place. The first letter of the menu item name may be pressed to select the menu item. Some menu items may be selected with a hot key which is described in Special Keys. Status line The status line is located at the bottom of the screen. It is a single line that displays a simple description about the currently selected menu item. For further information on the current menu item, press F1 for help. Entering filenames or text Filenames and text are entered in many different places. Both are entered using the same basic mechanism. A prompt for a filename or text places a box on the screen just below the menu item that was picked to request the information. This box contains a description of what type of information should be entered. Below the description line is the line on which the information will be entered. This line will either start off empty or contain whatever information has previously been entered for that item. If there was text that was previously entered and it is displayed, the cursor will be positioned at the end of it. The first keypress is very important. Pressing any alphanumerical key will clear this text and start a new entry with that key. Pressing any type of cursor movement key such as Home, End, Cur Left, Cur Right, Backspace, or Del will immediately start to edit the existing text. If Esc is pressed before Enter is pressed, the original text is not changed. The Esc key is sort of an "oh-no" key. It lets you back out of a mistake before it's too late. 11 TimeStack User's Guide Chapter Two - Menus and Windows Entering numbers and addresses Numbers are entered the same way that text is entered. Any previously entered number is displayed and a new number may be typed in immediately or the old number may be edited. If Esc is pressed before Enter is pressed, the original number is not changed. All numbers that are entered must fall in a certain range. If the new number that is entered falls outside of this range when Enter is pressed, the number just entered is erased and the old number is redisplayed. This is typically used to limit that maximum value that may be entered. Information that requires a number to be entered will default to either decimal or hexadecimal without requiring any prefix or postfix characters. The default is logical for the value to be entered. Values that represent counts or number of times to do something are decimal numbers. Addresses are in hexadecimal. Upper and lower case is not significant when entering a number. This is only relevant for hexadecimal numbers and prefix or postfix characters. The default number base may be overridden by using a prefix or postfix. The two different prefixes that may be used to force a decimal number base are: * & &123 * d' d'123 or D'123 The five different prefixes that may be used to force a hexadecimal number base are: * $ $ABCD * 0x 0xABCD or 0XABCD * h' h'ABCD or H'ABCD * x' x'ABCD or X'ABCD * 0x' 0x'ABCD or 0X'ABCD The postfix that may be used to force a hexadecimal number base is: * h ABCDh or ABCDH 12 TimeStack User's Guide Chapter Two - Menus and Windows Menu Selections This section provides a reference to each menu item and prompt. It is arranged in the order that the menus appear on the screen. File ALT-F The File menu lets you manipulate all files in TimeStack. This includes loading the hex file, saving and restoring the node list, and getting and putting the configuration to disk. Load ALT-L This prompts the name of the hex file. The hex file is given a default extension of .HEX if no extension is entered. If an extension is not desired then enter the name as NAME. with a period on the end. The hex file may be Motorola or Intel hex format. For a more complete discussion see the section titled Hex Files. The hex file is automatically loaded if a configuration file is loaded and there is a hex file name specified in its configuration. Restore ALT-R The node list file name is entered here. This name is used to read in the special node list file. Any name entered here will also be used by the menu File | Save described next. The node list file is given a default extension of .NOD if no extension is entered. If an extension is not desired then enter the name as NAME. with a period on the end. The node list file is automatically loaded if a configuration file is loaded and there is a node list file name specified. Save ALT-S This name is used to write out the special node list file. The node list file name entered here is the same name used in the menu File | Restore described above. 13 TimeStack User's Guide Chapter Two - Menus and Windows The node list file is given a default extension of .NOD if no extension is entered. If an extension is not desired then enter the name as NAME. with a period on the end. The node list file is automatically saved if the automatic node list file save feature is active in the Options | 2. Node menu and there is a node list file name specified. Get The configuration of TimeStack is read in from here. Any name entered here will also be used by the menu File | Put described next. The configuration file is given a default extension of .CFG if no extension is entered. If an extension is not desired then enter the name as NAME. with a period on the end. If a configuration file that matches the name of the program (i.e. TSDEMO.CFG for the demo program) is found when TimeStack starts up, that configuration is automatically loaded. Put The current TimeStack configuration is saved in this file. The configuration file name entered here is the same name used in the menu File | Get described above. The configuration file is given a default extension of .CFG if no extension is entered. If an extension is not desired then enter the name as NAME. with a period on the end. The configuration is automatically saved if the automatic configuration save feature is active in the Options | 1. Config menu and there is a configuration file name specified. Analysis ALT-A The start and stop addresses of the analysis to be done are entered here. The cursor starts out on the top line which is the start address. The hexadecimal start address obtained from the program listing is entered here. 14 TimeStack User's Guide Chapter Two - Menus and Windows Pressing Enter moves to the stop address on the next line. A hexadecimal stop address determined by inspecting the program listing is entered. If the analysis is on a procedure that finishes with a return from subroutine instruction, enter a hexadecimal value that contains all F's such as FFFF. The analysis will automatically stop when it finds a return from subroutine instruction. Pressing Esc from this line restores the previous value and moves the cursor back up to the start address line. Once the analysis has started, it may be aborted by pressing Esc. This causes a prompt to appear that asks if you really want to abort. Edit ALT-E A prompt for the address of an instruction to be edited is given. The instructions that may be edited are conditional branches, jumps to subroutines, jumps indirect, and jumps to subroutines indirect. The type of instruction will determine which menu is displayed next. Conditional branches The menu for conditional branches have the choices Take, Fall, Normal, or Delete. The options Take and Fall will prompt for a number that indicates how many times to take or fall through a conditional branch. A value of zero indicates that the branch should always be taken or always fall through. Jump to subroutine The menu for jumps to subroutines and jumps to subroutines indirect allow the maximum number of cycles and maximum stack depth to be entered. The maximum number of cycles will also be used for the minimum number of cycles in the analysis and the outcome in the Analysis Result window will be flagged to indicate the minimum number of cycles and worst case stack depth may not be accurate. The largest value that may be entered for the maximum number of cycles on a jump to subroutine is 65535. If this proves to be a limitation it may be possible to set its value to zero during the analysis and add the desired maximum number to the result afterwards. 15 TimeStack User's Guide Chapter Two - Menus and Windows Jump indirect The menu for jump indirect first displays the option to handle the jump indirect exactly as it would a return from subroutine instruction. If this is not chosen then the address that should be jumped to is prompted for. Clear ALT-C It is possible to clear nodes in the Special Nodes window one at a time using the Edit menu but this is time consuming. This option allows clearing all nodes from the given starting address through the given ending address inclusive. Disasm ALT-D The Disassembly window needs to know where to start when it disassembles a portion of the program. Enter the starting address for disassembly here. Options ALT-O There are many different options available so that you may customize your operation of TimeStack. Type of processor The type of processor is picked in this menu. This can have an effect on what opcodes are illegal and how many clock cycles an opcode uses. Some processor families have a large number of choices. This may mean a difference in timing characteristics or it may just allow the specific processor name to be chosen for display purposes. Appendix D will indicate the reason. Any time a processor is picked, the clock divisor value is reset to a default value for that processor. See the Options | Divisor menu. Clock rate The clock rate of the processor is entered here. This is used to calculate how many microseconds the maximum and minimum execution times are in the Analysis Results window. 16 TimeStack User's Guide Chapter Two - Menus and Windows The number entered is in megahertz. It must be between 0 and 200 MHz. It is a floating point number with at least five digits of accuracy. It may be entered as a regular number or using scientific notation. Divisor for clock Every processor has a factor that the external clock input is divided by. The external clock is divided by this value to obtain an internal clock that is referred to as the cycle time. Most processors have a fixed value for this internal divisor and this may be found in Appendix D. This default value may be changed using this menu. Normally this would only be done if the processor has a special customized selection for different divisors. This value is reset to a default value any time a processor is selected using the Options | Type menu. The number entered must be between 0 and 256. It is a floating point number with at least five digits of accuracy. It may be entered as a regular number or using scientific notation. Get You may get additional information on the current state of TimeStack. This includes file names, current processor type, clock rate, clock divisor, and memory available. 1. Config This option allows the configuration to be saved automatically when the Quit menu is invoked. 2. Node This option allows the node list to be saved automatically when the Quit menu is invoked. Print ALT-P The information obtained from the analysis may be saved in a file on disk or sent to a printer. 17 TimeStack User's Guide Chapter Two - Menus and Windows Comment A line at the top of the printed information may optionally contain a comment. That line is entered here and it remains until replaced with another line. 1. Path to File Outputs the current analysis results, maximum execution, minimum execution, and stack depth paths to a file. This file is usually saved for printing later. 2. Disasm to File Outputs the disassembled program to a file that is usually saved for printing later. The range that is disassembled begins at the analysis start address and finishes at the analysis end address. 3. Path to Printer Same as Print | 1. Path to File except the output is directed to the DOS print device PRN. Before the printing starts, a message is displayed that says to prepare the printer. When the printer is ready press Enter. To abort the print before it begins press Esc. When Enter is pressed another message is displayed that indicates printing is in progress. Esc may also be pressed at any time to halt the printing. A warning is displayed if a problem is encountered communicating with the printer. Typically this is some simple condition such as turning the printer on, checking to see that it has paper, and that it is on- line. Press Enter to try again after the problem has been fixed. Printing may also be aborted at this point by pressing Esc. 4. Disasm to Printer Same as Print | 2. Disasm to File except the output is directed to the DOS print device PRN. The printer operation is the same as 3. Path to Printer. 18 TimeStack User's Guide Chapter Two - Menus and Windows Quit ALT-Q Quit the TimeStack program. If the Special Nodes have been modified in any way and the save special nodes automatically feature is not active, a prompt is given to ask if the information should really be saved. Windows The majority of the screen contains six windows. These windows display a variety of information about the analysis. One displays the results of the most recent analysis. Other windows show the paths that were taken to achieve those results. Another window contains a list of all nodes that have been programmed and the last displays the disassembled program. Selecting a window Each of the six individual windows may be selected at any time. A selected window has a border with two lines around it. All other windows have a single line. In Figure 2-1 on page 10, window 1 - Special Nodes is currently selected. To select another window, press F3, F4, or ALT-1 through ALT-6. The key F3 makes the next window active, F4 makes the previous window active, and ALT-1 through ALT-6 selects the corresponding window by its number directly. Some windows selected may be able to scroll using the cursor keys. See the specific description of the windows below. Moving and sizing a window To move or size a window, press F6. This activates a mode that allows the window to be moved or sized using the Cur Up and Cur Dn keys. Pressing End toggles into and out of a mode that allows changing the size of a window. Press End once to enter the change size mode. Use the Cur Up and Cur Dn keys to move the lower right hand corner of the window to make it the desired size. Press End to toggle back into the move window mode or press F6 when the window is in the location and size desired. 19 TimeStack User's Guide Chapter Two - Menus and Windows Display of subroutines Conditional branches inside of subroutines called with a jump subroutine instruction are not displayed to avoid clutter. If the branching information for a subroutine is desired then the subroutine may be analyzed separately. Windows Displayed These are the windows that may be displayed. 1 - Special Nodes This window displays the current list of special nodes. A node is a conditional branch, a subroutine call, or a jump, branch or subroutine call that uses an indirect addressing mode. Each entry in the list of special nodes displays its position in the list, the address where it is located, the disassembled mnemonic, and any special settings it may have such as TAKE or FALL. This information may be saved and restored from the menu File | Save and File | Restore. The keys Home, CTRL-Home, End, CTRL-End, Pg Up, Pg Dn, Cur Up, Cur Dn, CTRL-Pg Up, CTRL-Pg Dn, F2, and F6 work as described in Special Keys when this window is selected. 2 - Disassembly This window displays a disassembled portion of the currently loaded program starting at the given address. It is not possible to page in front of the address entered to begin disassembly. This is because it is impossible to figure out where opcode boundaries are when moving backwards. The keys Home, CTRL-Home, End, CTRL-End, Pg Up, Pg Dn, Cur Up, Cur Dn, CTRL-Pg Up, CTRL-Pg Dn, F2, and F6 work as described in Special Keys when this window is selected. 20 TimeStack User's Guide Chapter Two - Menus and Windows If the window is made wider it is possible to see additional information about each instruction. There are three columns that contain the following information in this order: * number of bytes, * number of cycles, and * amount of stack used. 3 - Analysis Results The Analysis Results window shows the results from the most recent analysis that has been run. It displays the start address entered. The stop address displayed is either the one entered or the one found. The number of bytes is useful for quickly determining the size of a procedure. The number of bytes is calculated as: Stop address - Start address + opcode size at Stop address The maximum and minimum cycle time differences are caused by conditional branches. The minimum cycle time is flagged with a + if any conditional branches that are forced to always take or fall through or a user defined jump to subroutine is encountered. The maximum stack depth is flagged with a + if any conditional branches that are forced to always take or fall through are encountered. The stack depth now shows the current stack pointer. It should normally show -2 after timing a subroutine ending with a return from subroutine. 4 - Maximum Execution This window shows the worst case execution path from the most recent analysis. The keys Home, CTRL-Home, End, CTRL-End, Pg Up, Pg Dn, Cur Up, Cur Dn, CTRL-Pg Up, CTRL-Pg Dn, F2, and F6 work as described in Special Keys when this window is selected. 21 TimeStack User's Guide Chapter Two - Menus and Windows 5 - Minimum Execution This window shows the best case execution path from the most recent analysis. The keys Home, CTRL-Home, End, CTRL-End, Pg Up, Pg Dn, Cur Up, Cur Dn, CTRL-Pg Up, CTRL-Pg Dn, F2, and F6 work as described in Special Keys when this window is selected. 6 - Stack Depth This window shows the worst case stack depth path from the most recent analysis. The keys Home, CTRL-Home, End, CTRL-End, Pg Up, Pg Dn, Cur Up, Cur Dn, CTRL-Pg Up, CTRL-Pg Dn, F2, and F6 work as described in Special Keys when this window is selected. Special Keys Some keys perform a specific function. They include function keys and hot keys. Function keys The function keys with a special purpose are: F1 Obtains context sensitive on-line help. A window in the middle of the screen is opened and additional information relating specifically to the current menu selection or error message is given. F2 Pulls down the Edit menu ready to edit the instruction located at the address that is positioned on the top line of the currently selected window. This allows for quickly changing something that was located while browsing the special nodes, disassembled program, or one of the three paths. F3 Moves the currently selected window to the next one in numerical order. F4 Moves the currently selected window to the previous one in numerical order. F5 Reserved for future use. 22 TimeStack User's Guide Chapter Two - Menus and Windows F6 Allows moving the current window around and changing its size on the screen. Hot keys Hot keys allow quick movement to a specific menu. All of the items on the main menu can be reached by pressing ALT followed by its first letter. The currently defined hot keys are: ALT-A Analysis ALT-C Clear ALT-D Disasm ALT-E Edit ALT-F File ALT-L File | Load ALT-O Options ALT-P Print ALT-Q Quit ALT-R File | Restore ALT-S File | Save ALT-1 - ALT-6 Select the window with that number. Other keys Home Moves the current line to the beginning in the selected window. When entering a filename, text, or number, it moves the cursor to the first character in the line and no longer affects the selected window. CTRL-Home Moves the current line to the beginning in the selected window. End Moves the current line to the end in the selected window. When entering a filename, text, or number, it moves the cursor to the last character in the line and no longer affects the selected window. 23 TimeStack User's Guide Chapter Two - Menus and Windows CTRL-End Moves the current line to the end in the selected window. Pg Up Moves the current line in the selected window up one full window's worth. Pg Dn Moves the current line in the selected window down one window's worth. Cur Up Moves the current line in the selected window up one line. If a pull down menu is active, the highlight bar will move to the previous item instead of affecting the selected window. CTRL-Pg Up Moves the current line in the selected window up one line. Cur Dn Moves the current line in the selected window down one line. If a pull down menu is active, the highlight bar will move to the next item instead of affecting the selected window. CTRL-Pg Dn Moves the current line in the selected window down one line. Ins Toggles insert mode when entering data. Del Deletes the character at the cursor position. Backspace Deletes the character just in front of the cursor. Cur Left Moves the cursor left one character. Cur Right Moves the cursor right one character. On-Line Help On-Line help is available at any time by pressing F1. This opens the help window which will contain additional context sensitive information on the current menu item. Pressing F1 again or pressing Esc will exit the on-line help. If the description is large enough it may be necessary to use Pg Up and Pg Dn to see all of it. 24 TimeStack User's Guide Chapter Three - Understanding TimeStack Chapter Three - Understanding TimeStack Explaining assembly language programming is beyond the scope of this guide. The reader should already be familiar with assembly language programming. Detail is provided in some areas so that programmers familiar with only one microprocessor may understand the examples and demo program that have been provided. Assembly Language Formats Throughout this User's Guide there are many references to, and examples of, assembly language programs. Different manufacturers of microprocessors and providers of assemblers have their own nuances when it comes to the style of the assembly language source code. The format that a particular assembler uses for its source code is of no consequence to TimeStack. It looks only at the generated hex data output of the assembler and accepts Intel or Motorola hex files. This guide will use the following format in its examples of assembly language programs: * a label must be terminated by a colon and begin in column one, * the opcode field never starts in column one, 25 TimeStack User's Guide Chapter Three - Understanding TimeStack * there must be at least one space between the opcode field and the operand field, and * comments must begin with a semicolon. All examples in this guide will use the Motorola 6800 assembly language mnemonics because it is generally well known. Many of the other Motorola microprocessors have similarities in mnemonics. Programmers of Intel and other families of microprocessors should have no problem understanding the concepts that the simple examples will be showing. Figure 3-1 is an example of a typical listing. The first column is a line number. The second column is the address that the instruction is located at. The next bytes of data are the machine code for the opcode on that line. 000001 0000 ; Test procedure 000002 0000 ; 000003 0000 TEST: 000004 0000 8100 CMPA #0 000005 0002 2701 BEQ SKIP 000006 0004 4F CLRA 000007 0005 39 SKIP: RTS Figure 3-1 Typical Assembly Language Listing Differences in mnemonics There are probably as many different mnemonics as there are different processor families. Here is a table of the nomenclature used in this manual along with some of the common processors available for TimeStack. 26 TimeStack User's Guide Chapter Three - Understanding TimeStack MOTOROLA INTEL DESCRIPTION 6800 / 6805 8051 / 8048 Jump JMP JMP Jump indirect JMP 0,X JMP @A+DPTR Jump subroutine JSR CALL Jump subroutine indirect JSR 0,X Return subroutine RTS RET Branch relative BRA JMP Conditional branch if zero BEQ JZ Conditional branch if not BNE JNZ zero Many of the other opcodes have similar minor differences. Demo program limitations The demonstration program that is included with TimeStack is based on the Motorola 6811 processor. Some things have been removed to make it smaller and thus it has the following limitations: * The opcodes that manipulate the B or D registers have been removed. * Any special opcodes such as MUL have been removed. Hex Files TimeStack reads the hex file that represents a program for use in its analysis. A hex file contains the ASCII representation of bytes of information. Using a hex file to save binary information that is loaded at specific memory addresses is beneficial for a couple of reasons. First, the starting address that a block of data should be located is included. Second, each line has a checksum. Third, a hex file is human readable. The hex file name is entered on the File | Load menu. There are many different hex file formats. The two most popular formats are referred to as Motorola Hex and Intel Hex. TimeStack looks at the hex file and attempts to determine if it is a Motorola or Intel hex file based on the first couple of characters in each record. The checksum is calculated and checked for each record. The record is loaded into TimeStack and placed in a virtual 27 TimeStack User's Guide Chapter Three - Understanding TimeStack memory area at the address specified for it by the record. Motorola hex files Motorola hex files are composed of records. There is one record per line. Each line begins with the letter S and are thus often referred to as S records. The next letter is a number that indicates the type of S record. Each byte of data is represented by two hex digits. The first byte is the number of bytes that follow and its value does not count itself. The next two bytes represent a 16-bit address where the data bytes in the current record should be located. The address is followed by the data bytes. The last byte in the record is the checksum and its value is calculated such that the sum of all bytes in the record when truncated to a one byte value have the hexadecimal value of FF. If you were to look at an S record it might look something like this. S10D10500501014A26FC0926F839BF Separating this into its different fields makes it easier to see. S1 0D 1050 05 01 01 4A 26 FC 09 26 F8 39 BF S1 is the record type, 0D is the number of bytes (14 decimal), 1050 is the address that the data bytes 05, 01, ... 39 are placed, and BF is the checksum. Intel hex files Intel hex files are also composed of records, one record per line. Each line begins with a colon. Each byte of data is represented by two hex digits. The first byte is the number of data bytes. That is followed by two bytes that form a 16-bit address where the data bytes should be placed. The next byte is the record type. This is followed by the data bytes. Last is the checksum, its value calculated so that the sum of all bytes in the record comes out to a value of zero when truncated to a single byte. If you were to look at an Intel record it might look something like this. 28 TimeStack User's Guide Chapter Three - Understanding TimeStack :0A0860006300FF63FF0063FFFF2247 Separating it into its different fields results in this. : 0A 0860 00 63 00 FF 63 FF 00 63 FF FF 22 47 Where 0A is the number of data bytes (10 decimal), 0860 is the address that the data bytes 63, 00, ... 22 are placed, and 47 is the checksum. Possible errors The possible errors loading a hex file are: * The file may not appear to be a hex file. This could be cause by the first character in each line not being the letter S or a colon. * The checksum is incorrect. This would indicate a fundamental problem with the hex file, perhaps a problem in copying at some point or corrupt data. Program Listings A program listing is required to do an analysis with TimeStack. Program listings are produced by an assembler. They show the absolute locations of the generated object code for each assembly language instruction. They are needed because these addresses are entered by the user so that analysis may take place. Configuration Files Configuration files are used to save information about TimeStack that is useful to restore when TimeStack is executed in the future. Some of the things saved in a configuration file are: * Start and stop addresses * Window size and location on the screen * Processor type selected, clock rate, and clock divisor. 29 TimeStack User's Guide Chapter Three - Understanding TimeStack The default name for a configuration file is the name of the TimeStack executable with .CFG as an extension. Thus, for the demo program the default name would be TSDEMO.CFG. If the default configuration file is found in the current working directory when TimeStack starts up, it is automatically loaded. Node Files Node files contain the information displayed in the Special Nodes window. They are useful for saving any special conditional branch setups or jump subroutine instruction override information. The file name is automatically given the extension .NOD if none has been entered. Temporary Files Temporary files are created in the current working directory when TimeStack runs. At least 50K of free disk space is needed to hold them. The names of the temporary files created while running are: MAXDATA.TMP, MINDATA.TMP, and STKDATA.TMP. If there is no space to hold these files a fatal error message is displayed and TimeStack returns to DOS. Start and Stop Addresses The start and stop addresses are considered to be inclusive in the analysis. They may also be the same value, in which case only the single instruction at that address is analyzed. If the instruction at the stop address is a jump subroutine, the subroutine will be included in the analysis results. Even though the stop address may be less that the start address, there are few, if any, practical reasons to do this. Most processors and programs have a flow of execution that moves toward increasing address values. A stop address composed of all F's is special. It tells TimeStack to look for a return from subroutine instruction and stop the analysis when it is encountered. The stop address and size of the procedure 30 TimeStack User's Guide Chapter Three - Understanding TimeStack displayed in the Analysis Results window will automatically be determined. Timing Concepts A program is composed of a series of sequential statements. These statements are executed by the processor one at a time in a linear fashion, sequencing through program memory. The length of time it takes to execute any given series of statements is calculated as the sum of each instruction's execution time. The linear processing of statements may be interrupted by special instructions called branches or jumps. In the simple case, the linear flow changes to another address location in program memory and continues its linear flow. It is the job of TimeStack to look at every possible combination of these paths to obtain the results of the analysis. Conditional Branches Processors have a special instruction called a conditional branch that allows them to make a choice between one of two paths to take. The linear flow through a conditional branch may continue and FALL through, or the processor may TAKE the conditional branch and disrupt the flow. In TimeStack a branch is NORMAL when both directions are analyzed. TimeStack looks at the flow of execution from a given starting address in program memory to a given stop address in program memory. The analysis determines what combination of TAKEs and FALLs gives the absolute worst case theoretical time possible and shows this path. It also shows the best (or fastest) time and its path. It also shows the worst case stack depth usage and its path. Take A conditional branch has an address associated with it. When the branch is taken, program execution continues at this address. 31 TimeStack User's Guide Chapter Three - Understanding TimeStack The number of times a branch is taken before it falls though may be associated with a conditional branch. A branch may also be forced so that it is always taken. Fall If a conditional branch is not taken, it must fall through. Program execution continues with the instruction immediately following the conditional branch when it falls through. The number of times a branch falls through before it is taken may also be associated with a conditional branch. A branch may be forced to always fall through. Normal A branch that has no special conditions associated with it such as take or fall is considered to be normal. Conditional branches that move backwards might be part of a loop. To indicate to TimeStack that this is not the case, they may be set to normal. Program Loops A loop is only possible if some type of backwards branching occurs. TimeStack is not a simulator and has no knowledge of the possible implications of a backwards branch. If the backwards branch causes some type of loop to be formed, the user must assist the TimeStack and give more information about the loop. The user tells TimeStack how a conditional branch should operate in special situations. This is done by indicating how many times a conditional branch should FALL through before taking a branch or how many times to TAKE the branch before falling through. !! -> A conditional branch may be set to TAKE (take the branch), FALL (fall through the branch), and NORMAL (try both take and fall paths). In addition, TAKE and FALL may be set to a number that indicates how many times to take a branch before falling through or how many times to fall through before taking the branch. A conditional branch may be said to TAKE 5 times. This means TimeStack would not look at the path that falls through until it has followed the path the branch takes five times. 32 TimeStack User's Guide Chapter Three - Understanding TimeStack A NORMAL conditional branch is one that branches backwards yet is not actually a part of a loop. The conditional branch in Figure 3-2 would be set to TAKE 26 times. This is one less that the actual number of times the loop is done because the 27th time through the loop, the branch is not taken but falls through. 000001 0006 ; Loop type 1 000002 0006 ; 000003 0006 861B LDAA #27 000004 0008 6F00 LOOP1: CLR 0,X 000005 000A 08 INX 000006 000B 4A DECA 000007 000C 26FA BNE LOOP1 000008 000E 39 RTS Figure 3-2 Loop with Exit at Bottom The conditional branch in Figure 3-3 would be set to FALL 27 times. That is because the increment of the loop counter is done after the conditional branch test. 000001 000F ; Loop type 2 000002 000F ; 000003 000F CE0000 LDX #0 000004 0012 8C001B LOOP2: CPX #27 000005 0015 2705 BEQ DONE 000006 0017 6F00 CLR 0,X 000007 0019 08 INX 000008 001A 20F6 BRA LOOP2 000009 001C 39 DONE: RTS Figure 3-3 Loop with Exit in the Middle 33 TimeStack User's Guide Chapter Three - Understanding TimeStack Look at these examples very closely. Understanding how many times to specify a branch to TAKE or FALL is very important. This information is entered using the Edit menu and specifying the address of the conditional branch. Subroutines The processor instructions that jump, branch, and jump subroutine change the execution path. If a jump or branch is backwards, then there is the possibility of an infinite loop. In these cases the user is given the chance to edit the special node information which usually means setting up a conditional branch to TAKE or FALL some number of times. Warning If a jump subroutine is encountered, then it is assumed that a return from subroutine will be found. The stop address is ignored during the jump to subroutine. When a return from subroutine is found, TimeStack returns to the location immediately following the jump subroutine even if the return address on the stack was changed. A maximum cycle time and stack depth may be associated with any jump subroutine instruction. The values entered will be used whenever that instruction is encountered. This allows calls from different locations in the program to the same subroutine to have different maximum cycle times and stack depth values. The value entered for maximum cycle time is also used for the minimum cycle time. This causes the minimum cycle time to be flagged (see Windows - Statistics). Jump subroutine instructions that are indirect must have the cycle time and stack depth information entered for them. This is more versatile than entering a destination address. The analysis will always include the cycle time and stack depth of the jump subroutine instruction itself. Thus, a value of zero for both the cycle time and stack depth will only include the cycle time and stack depth for the jump subroutine instruction. 34 TimeStack User's Guide Chapter Three - Understanding TimeStack Jump Indirect Jump instructions that are indirect may have an address associated with them. If none has been entered for them, then a prompt for an address will be given on the first occurrence of the instruction during analysis. The option to pretend the instruction is a return subroutine is also made. This is useful for subroutines that pull the return address and use it at a later time as shown in Figure 3-4 000001 001D ; Jump indirect used 000002 001D ; as return subroutine 000003 001D ; 000004 001D JMPIND: 000005 001D 01 NOP 000006 001E 38 PULX 000007 001F 6E00 JMP 0,X Figure 3-4 Jump Indirect used as Return from Subroutine Stack Depth When an analysis is done, the current stack depth is assumed to be zero. As the analysis progresses there may be instructions that modify the stack by pushing and pulling data. If any instructions that modify the stack pointer directly are encountered, the resulting values from the analysis will not be correct. 35 TimeStack User's Guide Chapter Four - Tutorial Chapter Four - Tutorial Using TimeStack is usually as simple as specifying the starting address of a subroutine. It can analyze the complete control function of a complex algorithm that takes hundreds of milliseconds to execute as easily as it handles checking how many microseconds a multiply function takes to run. This will be a short look at a typical analysis. The executable program and files used here are included with TimeStack. Just start at the beginning here and work your way through one step at a time. Look at Listing The first step should be to look over a listing of the program to get an understanding of what it does. The program in Appendix A is a nonsense program that only provides routines for learning about TimeStack. The hex file that matches this listing is called: DEMO.HEX. Invoking Program The program is invoked by changing to the TimeStack directory and typing the name of the program that corresponds to the processor family desired. To run the correct program for the demo type: TSDEMO. 36 TimeStack User's Guide Chapter Four - Tutorial Configuring TimeStack The first time TimeStack is entered it will be necessary to configure it. Choose the Options menu by pressing the letter O from the main menu or the hot key ALT-O from any place in the program. The submenu Type allows selection of the specific processor. Press T to select this item or press Enter since the highlighted menu bar is already on the item. In this case there is no choice to make. The demo program knows only one type of processor, the 68DEMO. Press 1 to select it specifically, Enter to choose the currently selected item, or Esc to abort any changes. The submenu Clock allows entering the clock rate of the processor that will be used. Use the Cur Dn key to select this item and press Enter or just press the letter C as a shortcut. To obtain the same results that will be shown here be sure the value is set to 1 which means 1.0 megahertz. The submenu Get information displays a variety of information. At the top is the current version of the TimeStack program. Also shown is the currently selected processor, clock rate, and clock divisor. The current working directory and all file names that have been entered or have default values are given. The amount of available memory for use in analysis is shown. It is usually desirable to save any work that has been done. This may be set up to be done automatically upon exit. Use the submenu 1. Configuration to have the configuration automatically saved. Use the submenu 2. Node list to have the special node list automatically saved. Enable both of these options by answering Yes at their prompts. Load the Hex File Press ALT-L to jump right to the File | Load menu. At the prompt for the hex data file name, enter DEMO. This is the name of the demonstration hex file and the extension .HEX will automatically be added. Immediately after pressing Enter, a box is displayed in the center of the screen. It indicates that it is loading the hex file. The box disappears after the hex file is loaded. 37 TimeStack User's Guide Chapter Four - Tutorial Timing Subroutines Press ALT-A to move quickly to the Analysis menu. Figure 4-1 shows the procedure to be analyzed. For the start address type in 2A and press Enter. Note that leading zeros on addresses do not need to be entered. For the stop address leave the FFFF that is already there and press Enter again. This tells the TimeStack to analyze the procedure called SIMPLE that starts at address 002A and to stop when a return from subroutine instruction is encountered. 000021 002A ; Simple subroutine 000022 002A ; 000023 002A ; no conditional branches. 000024 002A ; 000025 002A ; 11 min 11 max 0 stack 000026 002A ; 000027 002A SIMPLE: 000028 002A 40 NEGA 000029 002B 48 ASLA 000030 002C 8B05 ADDA #5 000031 002E 39 RTS Figure 4-1 Simple Subroutine The Analysis Results window will show that this small procedure took a minimum of 11 CPU internal clock cycles, a maximum of 11 cycles, and a maximum stack depth of 0 bytes of stack. Notice that the stack depth now indicates -2 bytes. This represents the stack pointer right now after the analysis has finished. It means nothing was left remaining on the stack. In fact, two bytes have been pulled off that were not pushed on during the analysis. This is caused by the return from subroutine instruction pulling its two bytes of address information off of the stack. 38 TimeStack User's Guide Chapter Four - Tutorial The actual stop address was found for us. The subroutine ranges from 002A to 002E. Its size was 5 bytes. Using a 1 Megahertz external clock this subroutine will execute in an absolute worst case maximum time of 44.0 microseconds. This includes the time from the start of the first instruction until the return from subroutine instruction finishes. Timing Subroutines with Conditional Branches From now on it will be assumed that you are familiar with how to analyze a procedure from the Analysis menu. If you are not, review the previous section again. The stop address for most of the examples will be left at FFFF. Now analyze the procedure called FWDBRA. Figure 4-2 contains this procedure. It has a start address of 002F. The results of this analysis have put some information in the Maximum Execution, Minimum Execution, and Stack Depth windows. It shows that to obtain the maximum execution time the conditional branch at 0030 must FALL through, the branch at 0036 must TAKE, and the last branch at 003E must FALL through. Only conditional branches are shown because they are the only opportunity to change program flow. 39 TimeStack User's Guide Chapter Four - Tutorial 000032 002F ; Forward branches 000033 002F ; 000034 002F ; only forward branches. 000035 002F ; 000036 002F ; 16 min 26 max 0 stack 000037 002F ; 000038 002F FWDBRA: 000039 002F 47 ASRA 000040 0030 2406 BCC FWD010 000041 0032 CE002A LDX #SIMPLE 000042 0035 47 ASRA 000043 0036 2405 BCC FWD020 000044 0038 FWD010: 000045 0038 CE002F LDX #FWDBRA 000046 003B 2006 BRA FWDRET 000047 003D FWD020: 000048 003D 47 ASRA 000049 003E 2403 BCC FWDRET 000050 0040 CE0044 LDX #BCKBRA 000051 0043 FWDRET: 000052 0043 39 RTS Figure 4-2 Forward Branches It should be mentioned that the paths shown by TimeStack only represent one way to achieve the analysis results. There may be others that are equal but not shown. The next procedure is called BCKBRA. This is shown in Figure 4-3. Begin the analysis by entering its start address of 0044. Any branch that has a destination which can move the execution backwards creates the possibility of forming a loop. The Edit Branch window is opened on the branch at 0054. The edit window indicates the branch is CLEAR because it has not had any attributes set. This branch does not participate in forming any kind of loop. It merely branches backwards to a return from subroutine instruction. Of the four possible choices, choose Normal for this branch. 40 TimeStack User's Guide Chapter Four - Tutorial 000053 0044 ; Backward normal branches 000054 0044 ; 000055 0044 ; all normal branches. 000056 0044 ; 000057 0044 ; 16 min 26 max 0 stack 000058 0044 ; 000059 0044 BCKBRA: 000060 0044 47 ASRA 000061 0045 2407 BCC BCK010 000062 0047 CE002A LDX #SIMPLE 000063 004A 47 ASRA 000064 004B 2406 BCC BCK020 000065 004D BCKRET: 000066 004D 39 RTS 000067 004E BCK010: 000068 004E CE002F LDX #FWDBRA 000069 0051 20FA BRA BCKRET 000070 0053 BCK020: 000071 0053 47 ASRA 000072 0054 24F7 BCC BCKRET 000073 0056 CE0044 LDX #BCKBRA 000074 0059 39 RTS Figure 4-3 Backwards Branches that are Normal The analysis continues to run but now issues a warning about a backwards branch at 0051. This branch, since it also moves backwards, may be forming part of a loop. Upon inspection it is seen that this is not the case. Press any key to remove the warning and then respond to the edit branches now prompt with a No. The Special Nodes window now displays the conditional branch that was entered during the analysis. Timing Loops Simple loop The procedure SIMPLOOP at address 005A shown in Figure 4-4, forms a simple loop. Begin the analysis of this 41 TimeStack User's Guide Chapter Four - Tutorial procedure. The conditional branch at 005E will be pulled up during the analysis. In order to determine what should be entered it will be necessary to look at the program logic. In this case, it looks as if the code inside the loop should be executed five times. To achieve this the conditional branch will be taken four times. The fifth time through the loop the branch falls through. At the prompt for the branch choose Take. At the prompt for the number of times enter 4. 000075 005A ; Simple loop 000076 005A ; 000077 005A ; A simple loop. 000078 005A ; 000079 005A ; 42 min 42 max 0 stack 000080 005A ; 000081 005A SIMPLOOP: 000082 005A 8605 LDAA #5 000083 005C SIMP010: 000084 005C 01 NOP 000085 005D 4A DECA 000086 005E 26FC BNE SIMP010 000087 0060 39 RTS Figure 4-4 Loop with Exit at Bottom When the analysis is complete press ALT-4. This selects the Maximum Execution Window (window number four). Use the Cur Up and Cur Dn keys to look at all of the entries. Follow the loop through and see how it works. Understanding this is very important when configuring a loop. Loop with middle exit The procedure BACKLOOP at address 0061 shown in Figure 4-5 is another common type of loop. It has its exit near the top or middle. Begin the analysis. TimeStack will warn that the branch at address 0067 is backwards and ask if you want to edit branches at this time. 42 TimeStack User's Guide Chapter Four - Tutorial Answer with a Yes. It is necessary to inspect the program to determine which conditional branch must be configured to exit the loop. The branch at address 0064 is the correct one for this example. It must be set to Fall through five times. Understanding this type of loop is also very important. 000088 0061 ; Loop with backwards branch 000089 0061 ; 000092 0061 ; 000093 0061 ; 62 min 62 max 0 stack 000094 0061 ; 000095 0061 BACKLOOP: 000096 0061 8606 LDAA #6 000097 0063 BACK010: 000098 0063 4A DECA 000099 0064 2703 BEQ BACKRET 000100 0066 01 NOP 000101 0067 20FA BRA BACK010 000102 0069 BACKRET: 000103 0069 39 RTS Figure 4-5 Loop with Middle Exit Printing the Results The results of this analysis may be sent to a printer. Be sure the printer is turned on, loaded with paper, and on-line. The output is sent to the DOS print device PRN. Press ALT-P to select the Print menu and then press 3. Path to Printer. A message will appear the says to prepare the printer. When the printer is ready, press Enter. The printing will then begin immediately. A message is displayed that indicates printing is in progress. Esc may be pressed during this time to abort. If there is a problem communicating with the printer, a message will be displayed indicating what is wrong. 43 TimeStack User's Guide Chapter Four - Tutorial After corrective action is taken press Enter to continue. Esc may be pressed to abandon the print. Quitting the Program Now quit the program by pressing ALT-Q. TimeStack will attempt to save the special node list but since a node list file name has not been entered yet it will as if you wish to save your changes. Answer Yes to this question and enter whatever name you wish to give the node list. If you do not enter an extension, .NOD will automatically be added. 44 TimeStack User's Guide Chapter Five - Timing Strategies Chapter Five - Timing Strategies Have a Listing Ready It is very impractical to use TimeStack without a current listing of the program to be worked on. It is possible to use the Disassemble feature to assist but this is still difficult. A listing provides all of the addresses that will need to be entered as start addresses and when editing conditional branches. It will be needed to determine how many times to take loops and destination of indirect jumps. What Units to Use All timing information is given in cycles. This refers to the processor's internal cycles as defined by the manufacturer of the device. For convenience, this number is calculated to microseconds based on the given external clock rate divided by the clock divisor value. All memory usage is defined in bytes. A byte is eight bits of information and is a fundamental unit to all processors handled by TimeStack. All stack usage is measured in bytes. Start Small It is usually best to start with the smaller subroutines that may be called from throughout the 45 TimeStack User's Guide Chapter Five - Timing Strategies program. This way, many of the loops will be discovered early without having to search through the listing. Look at the different paths (maximum cycles, minimum cycles, and worst case stack depth) and follow them through the listing a couple of times to develop a feel for the program. Compare the results on subroutines that have been timed and documented before. Be Realistic The worst case path may not be realistic and you may desire to force a few branches to avoid this. This usually happens when the logic gets divided into multiple parts or spread out. It also happens when the same condition is checked numerous times throughout the program. Figure 5-1 is a simple example of this. In the first part of the logic the NOP instruction will be executed if register A is not equal to zero. In the second part of the logic the NOP instruction will be executed if accumulator A is equal to zero. Obviously both NOPs could not be executed during the same pass through the procedure. TimeStack does not detect this and the maximum execution time will include the time for both NOPs. In the same way, the minimum execution time will not time either NOP. 000001 0000 ; Unrealistic worst case path 000002 0000 ; 000003 0000 UNREAL: 000004 0000 8100 CMPA #0 000005 0002 2701 BEQ SKIP1 000006 0004 01 NOP 000007 0005 SKIP1: 000008 0005 8100 CMPA #0 000009 0007 2600 BNE SKIP2 000010 0009 01 NOP 000011 000A SKIP2: 000012 000A 39 RTS Figure 5-1 Unrealistic Worst Case Path 46 TimeStack User's Guide Chapter Five - Timing Strategies It helps if this type of logic is located in a subroutine. By forcing one of the branches to always be taken, the realistic maximum execution time will be found. Then if this procedure is subsequently called from another procedure the expected results will be found. More Than One Path It is possible that there is more than just the single path shown by TimeStack that meets the maximum and minimum execution time and maximum stack depth. Figure 5-2 is a simple example of a procedure that has identical execution times no matter which path is taken. 000013 000B ; Identical Paths 000014 000B ; 000015 000B IDENT: 000016 000B 8100 CMPA #0 000017 000D 2702 BEQ IDENT1 000018 000F 01 NOP 000019 0010 39 RTS 000020 0011 IDENT1: 000021 0011 01 NOP 000022 0012 39 RTS Figure 5-2 Identical Worst Case Paths As it turns out, in most cases this is not usually a problem. If you attempt to optimize the given maximum execution path and make changes to it, future analysis will find the new resulting maximum execution paths. 47 TimeStack User's Guide Chapter Six - Advanced Tutorial Chapter Six - Advanced Tutorial There are many more subtle points that need to brought out to use the full capabilities of TimeStack and obtain accurate results. The complete program for all of the procedures here can be found in Appendix A. Invoke Program Again Invoke the TimeStack demo program again. If you have not already run the program at least once, see the Chapter Four tutorial. Briefly this involves changing to the TimeStack directory and typing in the demo program name: TSDEMO. If the demo hex file was not automatically loaded, return to Chapter Four and review Invoking Program, Configuring TimeStack, and Load the Hex File. Complex Loops A complex loop is one that TimeStack was not able to correctly analyze. This occurs because the conditional branch that was setup as the exit for the loop was not the conditional branch that really is the exit for the maximum execution path. Analyze the procedure COMPLEX at address 006A shown in Figure 6-1. The conditional branch at 0070 is brought 48 TimeStack User's Guide Chapter Six - Advanced Tutorial up in the edit window because it is a backwards branch and therefore may participate in a loop. Looking at the algorithm it can be determined that this branch should be set to TAKE 2. 000104 006A ; Complex loop 000105 006A ; 000106 006A ; A loop that will trigger the 000107 006A ; complex loop message. 000108 006A ; 000109 006A ; 43 min 43 max 2 stack 000110 006A ; 000111 006A COMPLEX: 000112 006A 8605 LDAA #5 000113 006C COMPL1: 000114 006C 4A DECA 000115 006D 2704 BEQ COMPX1 000116 006F 4A DECA 000117 0070 26FA BNE COMPL1 000118 0072 39 RTS 000119 0073 COMPX1: 000120 0073 BD0076 JSR COMPX2 000121 0076 COMPX2: 000122 0076 39 RTS Figure 6-1 Complex Loop During the analysis an error message is displayed. It says that the branch at address 006D is involved in a structure too difficult for a simple analysis. Upon closer inspection of the branch at 006D and the algorithm, it can be seen that the conditional branch at 006D is the true exit for the loop. Press ALT-E to pull up the Edit window, enter the address 006D, and set it to FALL 2. Now when the analysis is run, it completes with the correct answer. 49 TimeStack User's Guide Chapter Six - Advanced Tutorial Indirect Jump Indirect jumps are handled in a simple manner. They may either be forced to act just like a return from subroutine or you may enter an address to jump to. Analyze the procedure INDJMP at address 0077 shown in Figure 6-2. A message appears that says the indirect jump at address 0077 needs a destination. After you press Enter, you are asked if you would like to treat the indirect jump like a return from subroutine. In this example respond with No. A prompt for the destination of the indirect jump is given. Use the address 007A as the destination. 000123 0077 ; Indirect jump test 000124 0077 ; 000125 0077 ; Indirect jump that goes some 000126 0077 ; place and one that returns. 000127 0077 ; 000128 0077 ; 11 min 11 max 0 stack 000129 0077 ; 000130 0077 INDJMP: 000131 0077 6E00 JMP 0,X 000132 0079 01 NOP 000133 007A JMPRET: 000134 007A 38 PULX 000135 007B 6E00 JMP 0,X Figure 6-2 Indirect Jump Now the analysis stops at the indirect jump at 007B. Respond with Yes when it asks if it should be treated as a return from subroutine. The reason for this is the algorithm in this example pulls the return address from the stack and then uses the indirect jump to jump to that return address at the end of the procedure. This is exactly what a return from subroutine does and is a special way that indirect jumps are used in programs from time to time. 50 TimeStack User's Guide Chapter Six - Advanced Tutorial Untimeable Instructions Some instructions do not make sense to time. Start the analysis of INSTIME at address 007D shown in Figure 6- 3. The analysis will stop with an error stating that the opcode at 007F is not able to be analyzed for time. 000136 007D ; Instruction not timeable 000137 007D ; 000138 007D ; This can not be timed. 000139 007D ; 000140 007D ; 8 min 8 max 0 stack 000141 007D ; 000142 007D INSTIME: 000143 007D 2701 BEQ INST010 000144 007F CF STOP 000145 0080 INST010: 000146 0080 39 RTS Figure 6-3 Instructions that can not be timed This particular instruction, the STOP instruction, causes the processor to stop executing code. It does not make sense to time it. Illegal Instructions An opcode that is not recognized by the processor causes an error message to be displayed. If an analysis of procedure ILLEGAL at 0081 shown in Figure 6-4 is done, the error message will complain of an illegal opcode at address 0083. 51 TimeStack User's Guide Chapter Six - Advanced Tutorial 000147 0081 ; Illegal instructions 000148 0081 ; 000149 0081 ; These are illegal in demo. 000150 0081 ; 000151 0081 ; 8 min 8 max 0 stack 000152 0081 ; 000153 0081 ILLEGAL: 000154 0081 2701 BEQ ILL010 000155 0083 3D MUL 000156 0084 ILL010: 000157 0084 39 RTS Figure 6-4 Illegal Instructions If this is seen it is probably one of these problems: * The wrong hex file has been loaded. The hex file does not match the processor that this version of TimeStack handles. * The wrong processor has been chosen. Use the Options menu to verify that the correct processor is being used. * The wrong start address was entered. If the start address is not the beginning of an instruction it is difficult to predict how it will be disassembled. Nested Loops There are a couple of ways that loops may become nested. Nested loops have special considerations that must be taken into account. Loops inside subroutines Look at Figure 6-5 which shows the procedure OUTLOOP at address 0085. This procedure contains a loop that calls another procedure INLOOP using a jump subroutine. 52 TimeStack User's Guide Chapter Six - Advanced Tutorial 000158 0085 ; Outer loop 000159 0085 ; 000160 0085 ; Outer loop of nested loops. 000161 0085 ; 000162 0085 ; 482 min 482 max 3 stack 000163 0085 ; 000164 0085 OUTLOOP: 000165 0085 8605 LDAA #5 000166 0087 OUT010: 000167 0087 36 PSHA 000168 0088 BD0090 JSR INLOOP 000169 008B 32 PULA 000170 008C 4A DECA 000171 008D 26F8 BNE OUT010 000172 008F 39 RTS Figure 6-5 Loop with a call to a Procedure The procedure INLOOP shown in Figure 6-6 also contains a loop. Because this loop is located inside a procedure that is called using a jump subroutine, no special considerations are needed. 000173 0090 ; Inner loop 000174 0090 ; 000175 0090 ; Inner loop of nested loops. 000176 0090 ; 000177 0090 ; 77 min 77 max 0 stack 000178 0090 ; 000179 0090 INLOOP: 000180 0090 860A LDAA #10 000181 0092 IN010: 000182 0092 01 NOP 000183 0093 4A DECA 000184 0094 26FC BNE IN010 000185 0096 39 RTS Figure 6-6 Procedure that contains a Loop 53 TimeStack User's Guide Chapter Six - Advanced Tutorial Now analyze OUTLOOP starting at address 0085. The first branch that will be questioned is the one at 0094 in INLOOP. This is because it happens to be the first backwards branch encountered when the analysis took the jump subroutine. Upon inspection of the algorithm this branch should be set to Take nine times. The next backwards branch questioned is the one at 008D. This should be set to Take four times according to its algorithm. Loops inside other loops A loop that is inside of another loop does have special considerations. The procedure TWOLOOP at address 0097 as shown in Figure 6-7 is an example of this. There is an outer loop that is done five times. There is an inner loop that is done ten times every time the outer loop is done. Thus, the inner loop is done a total of 50 times. 000186 0097 ; Two loops 000187 0097 ; 000188 0097 ; Two loops in one. 000189 0097 ; 000190 0097 ; 436 min 436 max 0 stack 000191 0097 ; 000192 0097 TWOLOOP: 000193 0097 CE0005 LDX #5 000194 009A TWO010: 000195 009A 01 NOP 000196 009B 860A LDAA #10 000197 009D TWO020: 000198 009D 01 NOP 000199 009E 4A DECA 000200 009F 26FC BNE TWO020 000201 00A1 ; 000202 00A1 09 DEX 000203 00A2 26F6 BNE TWO010 000204 00A4 ; 000205 00A4 39 RTS Figure 6-7 Nested Loops 54 TimeStack User's Guide Chapter Six - Advanced Tutorial Edit the branch at 009F to Take 49 times and the branch at 00A2 to Take four times to get the correct results for this procedure. Subroutines with Different Execution Times Some subroutines have different execution times based on parameters they are called with. Look at Figure 6-8. The procedure VARLOOP at address 00A5 calls DIFSUB at address 00B4 with a parameter that changes its execution time. The proper way to analyze this situation is to look at the different trial runs and program each jump subroutine with the results. 000206 00A5 ; Variable loops 000207 00A5 ; 000208 00A5 ; Different loop times 000209 00A5 ; 000210 00A5 ; 211 min 211 max 2 stack 000211 00A5 ; 000212 00A5 VARLOOP: 000213 00A5 8605 LDAA #5 000214 00A7 BD00B4 JSR DIFSUB 000215 00AA 860A LDAA #10 000216 00AC BD00B4 JSR DIFSUB 000217 00AF 8614 LDAA #20 000218 00B1 7E00B4 JMP DIFSUB 000219 00B4 ; 000220 00B4 DIFSUB: 000221 00B4 4A DECA 000222 00B5 26FD BNE DIFSUB 000223 00B7 39 RTS Figure 6-8 Subroutines with Different Execution Times 55 TimeStack User's Guide Chapter Six - Advanced Tutorial The first time DIFSUB is called it loops five times. Edit the conditional branch at 00B5 to Take four times. Now analyze the procedure DIFSUB at address 00B4. You should get the 30 cycles for the maximum execution time and zero bytes for the maximum stack depth. Edit the jump subroutine at address 00A7. Enter the values just obtained at the prompts for maximum cycle time and maximum stack depth. The second time DIFSUB is called it loops ten times. Edit the conditional branch at 00B5 to Take nine times and run the analysis on it again. This time you should get 55 cycles for the maximum execution time and still zero bytes for maximum stack depth. Edit the jump subroutine at address 00AC and enter these values. The last time DIFSUB is called it loops twenty times. Edit the conditional branch at 00B5 to Take nineteen times. Now you can analyze VARLOOP at 00A5 to get its correct worst case results which should be 211 cycles. Stack Imbalance Analyze the procedure STKIMB at address 00B8 and shown in Figure 6-9. A warning is displayed that says a mismatch of the stack occurred following the conditional branch at address 00B9. It says that stack depth when the branch is taken is -2 bytes deep and when the branch falls through it is only -1 bytes deep. 000224 00B8 ; Stack Imbalance 000225 00B8 ; 000226 00B8 ; Stack may become imbalanced 000227 00B8 ; 000228 00B8 ; 10 min 13 max 1 stack 000229 00B8 ; 000230 00B8 STKIMB: 000231 00B8 01 NOP 000232 00B9 2601 BNE STK010 000233 00BB 36 PSHA 000234 00BC STK010: 000235 00BC 39 RTS Figure 6-9 Stack Imbalance 56 TimeStack User's Guide Chapter Six - Advanced Tutorial A close look at the algorithm shows what has happened. One path of the conditional branch at 00B9 will push a register while the other path does not. This creates the possibility of a stack imbalance. Infinite Loops Infinite loops in the program will eventually cause the analysis to reach an internal limitation and stop. Look at Figure 6-10. The procedure SIMPLOOP at address 005A has a conditional branch at 005E that forms a loop. Edit this branch and set it to Take always. This is done by setting the number of times to take the branch to zero. 000075 005A ; Simple loop 000076 005A ; 000077 005A ; A simple loop. 000078 005A ; 000079 005A ; 42 min 42 max 0 stack 000080 005A ; 000081 005A SIMPLOOP: 000082 005A 8605 LDAA #5 000083 005C SIMP010: 000084 005C 01 NOP 000085 005D 4A DECA 000086 005E 26FC BNE SIMP010 000087 0060 39 RTS Figure 6-10 Simple Loop Now do an analysis on this procedure. The analysis runs until an internal TimeStack limitation is reached. This is usually stack depth but it could be memory. Every time a conditional branch or jump subroutine is encountered in the analysis a little bit of internal 57 TimeStack User's Guide Chapter Six - Advanced Tutorial memory and stack depth is used by TimeStack. If the analysis encounters a loop that runs for a long time this internal limitation of TimeStack may eventually be reached. Memory limitations If a memory limitation is reached, it is up to the user to determine if or how the program entered into a large or infinite loop. In general, it is not a good idea to try and time loops that run for more than a couple of hundred iterations. Also, it may be that one of the conditional branches has not been programmed or programmed incorrectly. It may be possible to narrow down the area that is the problem by changing the start and stop addresses if a large procedure is being analyzed. A solution to timing loops that run for a large number of times is to time the loop when it is taken only once. Then time the loop when it is taken twice. Calculate the difference between these results and you have how long each time through the loop will take. Multiply this value by number of iterations minus one through the loop and add it to the time it took for once through the loop. It may even be beneficial to document how many cycles each iteration of the loop takes. Branch Past Stop Address Analyze the procedure FWDBRA at address 002F shown in Figure 6-11. Use a start address of 002F and a stop address of 003B. 58 TimeStack User's Guide Chapter Six - Advanced Tutorial 000032 002F ; Forward branches 000033 002F ; 000034 002F ; only forward branches. 000035 002F ; 000036 002F ; 16 min 26 max 0 stack 000037 002F ; 000038 002F FWDBRA: 000039 002F 47 ASRA 000040 0030 2406 BCC FWD010 000041 0032 CE002A LDX #SIMPLE 000042 0035 47 ASRA 000043 0036 2405 BCC FWD020 000044 0038 FWD010: 000045 0038 CE002F LDX #FWDBRA 000046 003B 2006 BRA FWDRET 000047 003D FWD020: 000048 003D 47 ASRA 000049 003E 2403 BCC FWDRET 000050 0040 CE0044 LDX #BCKBRA 000051 0043 FWDRET: 000052 0043 39 RTS Figure 6-11 Forward Branches A warning message indicates that the branch at address 0036 was past the stop address. When this condition occurs in an analysis only the first violation is shown. TimeStack does not look at any portion of the program that is past the stop address. In this example the take path of the conditional branch at 0036 is ignored. Actual Stop Address Still referring to Figure 6-11, do an analysis from 002F to a stop address of 1234. A warning is displayed that indicates the specified stop address was never reached. It says the true stop address is 0043. TimeStack figures out what the greatest execution address obtained is. This does not include jump to subroutines. If the stop address was not FFFF and the 59 TimeStack User's Guide Chapter Six - Advanced Tutorial stop address entered is greater than what TimeStack thinks it should have been, this warning is displayed. Forcing Conditional Branches Forcing branches to take different paths to analyze unique scenarios may be done quickly with the use of F2. Use the cursor keys to move the branch to be modified to the top of the Special Nodes window and press F2. This may also be done inside the Disassembly window. Save to File It is convenient to save the analysis for printing using the Print menu. It is helpful to have the disk file name match the name of the subroutine or module that was analyzed. High Level Languages It is possible to use TimeStack with a high level language. A listing of the compiled output from the high level language compiler with the generated assembly statements is needed. The listing is used to find the start and stop addresses of procedures and to figure out where the conditional branches are. Some knowledge of how the compiler creates loop structures is desirable. 60 TimeStack User's Guide Appendix A - Listing of Demo Program Appendix A - Listing of Demo Program 000001 0000 ; Main program 000002 0000 ; 000003 0000 ; 1424 min 1444 max 5 stack 000004 0000 ; 000005 0000 MAIN: 000006 0000 BD002A JSR SIMPLE 000007 0003 BD002F JSR FWDBRA 000008 0006 BD0044 JSR BCKBRA 000009 0009 BD005A JSR SIMPLOOP 000010 000C BD0061 JSR BACKLOOP 000011 000F BD006A JSR COMPLEX 000012 0012 BD0077 JSR INDJMP 000013 0015 BD007D JSR INSTIME 000014 0018 BD0081 JSR ILLEGAL 000015 001B BD0085 JSR OUTLOOP 000016 001E BD0097 JSR TWOLOOP 000017 0021 BD00A5 JSR VARLOOP 000018 0024 CE002A LDX #SIMPLE 000019 0027 AD00 JSR 0,X ; Uses 0 cycles 0 stack 000020 0029 39 RTS 61 TimeStack User's Guide Appendix A - Listing of Demo Program 000021 002A ; Simple subroutine 000022 002A ; 000023 002A ; Contains no conditional branches. 000024 002A ; 000025 002A ; 11 min 11 max 0 stack 000026 002A ; 000027 002A SIMPLE: 000028 002A 40 NEGA 000029 002B 48 ASLA 000030 002C 8B05 ADDA #5 000031 002E 39 RTS 000032 002F ; Forward branches 000033 002F ; 000034 002F ; Contains only forward branches. 000035 002F ; 000036 002F ; 16 min 26 max 0 stack 000037 002F ; 000038 002F FWDBRA: 000039 002F 47 ASRA 000040 0030 2406 BCC FWD010 000041 0032 CE002A LDX #SIMPLE 000042 0035 47 ASRA 000043 0036 2405 BCC FWD020 000044 0038 FWD010: 000045 0038 CE002F LDX #FWDBRA 000046 003B 2006 BRA FWDRET 000047 003D FWD020: 000048 003D 47 ASRA 000049 003E 2403 BCC FWDRET 000050 0040 CE0044 LDX #BCKBRA 000051 0043 FWDRET: 000052 0043 39 RTS 62 TimeStack User's Guide Appendix A - Listing of Demo Program 000053 0044 ; Backward normal branches 000054 0044 ; 000055 0044 ; Only backward normal branches. 000056 0044 ; 000057 0044 ; 16 min 26 max 0 stack 000058 0044 ; 000059 0044 BCKBRA: 000060 0044 47 ASRA 000061 0045 2407 BCC BCK010 000062 0047 CE002A LDX #SIMPLE 000063 004A 47 ASRA 000064 004B 2406 BCC BCK020 000065 004D BCKRET: 000066 004D 39 RTS 000067 004E BCK010: 000068 004E CE002F LDX #FWDBRA 000069 0051 20FA BRA BCKRET 000070 0053 BCK020: 000071 0053 47 ASRA 000072 0054 24F7 BCC BCKRET 000073 0056 CE0044 LDX #BCKBRA 000074 0059 39 RTS 000075 005A ; Simple loop 000076 005A ; 000077 005A ; A simple loop. 000078 005A ; 000079 005A ; 42 min 42 max 0 stack 000080 005A ; 000081 005A SIMPLOOP: 000082 005A 8605 LDAA #5 000083 005C SIMP010: 000084 005C 01 NOP 000085 005D 4A DECA 000086 005E 26FC BNE SIMP010 ; TAKE 4 000087 0060 39 RTS 63 TimeStack User's Guide Appendix A - Listing of Demo Program 000088 0061 ; Loop with backwards branch 000089 0061 ; 000090 0061 ; Simple loop with a normal backwards 000091 0061 ; branch that terminates in middle. 000092 0061 ; 000093 0061 ; 62 min 62 max 0 stack 000094 0061 ; 000095 0061 BACKLOOP: 000096 0061 8606 LDAA #6 000097 0063 BACK010: 000098 0063 4A DECA 000099 0064 2703 BEQ BACKRET ; FALL 5 000100 0066 01 NOP 000101 0067 20FA BRA BACK010 000102 0069 BACKRET: 000103 0069 39 RTS 000104 006A ; Complex loop 000105 006A ; 000106 006A ; A loop that will trigger the 000107 006A ; complex loop message. 000108 006A ; 000109 006A ; 43 min 43 max 2 stack 000110 006A ; 000111 006A COMPLEX: 000112 006A 8605 LDAA #5 000113 006C COMPL1: 000114 006C 4A DECA 000115 006D 2704 BEQ COMPX1 ; FALL 2 000116 006F 4A DECA 000117 0070 26FA BNE COMPL1 ; TAKE 2 000118 0072 39 RTS 000119 0073 COMPX1: 000120 0073 BD0076 JSR COMPX2 000121 0076 COMPX2: 000122 0076 39 RTS 64 TimeStack User's Guide Appendix A - Listing of Demo Program 000123 0077 ; Indirect jump test 000124 0077 ; 000125 0077 ; Indirect jump that goes some 000126 0077 ; place and one that returns. 000127 0077 ; 000128 0077 ; 11 min 11 max 0 stack 000129 0077 ; 000130 0077 INDJMP: 000131 0077 6E00 JMP 0,X ; Destination JMPRET 000132 0079 01 NOP 000133 007A JMPRET: 000134 007A 38 PULX ; Pull return address 000135 007B 6E00 JMP 0,X ; Indirect jump as RTS 000136 007D ; Instruction not timeable 000137 007D ; 000138 007D ; This can not be timed. 000139 007D ; 000140 007D ; 8 min 8 max 0 stack 000141 007D ; 000142 007D INSTIME: 000143 007D 2701 BEQ INST010 ; May be skipped 000144 007F CF STOP ; Stop instruction 000145 0080 INST010: 000146 0080 39 RTS 000147 0081 ; Illegal instructions 000148 0081 ; 000149 0081 ; These are illegal in demo. 000150 0081 ; 000151 0081 ; 8 min 8 max 0 stack 000152 0081 ; 000153 0081 ILLEGAL: 000154 0081 2701 BEQ ILL010 ; May be skipped 000155 0083 3D MUL 000156 0084 ILL010: 000157 0084 39 RTS 65 TimeStack User's Guide Appendix A - Listing of Demo Program 000158 0085 ; Outer loop 000159 0085 ; 000160 0085 ; Outer loop of nested loops. 000161 0085 ; 000162 0085 ; 482 min 482 max 3 stack 000163 0085 ; 000164 0085 OUTLOOP: 000165 0085 8605 LDAA #5 000166 0087 OUT010: 000167 0087 36 PSHA 000168 0088 BD0090 JSR INLOOP 000169 008B 32 PULA 000170 008C 4A DECA 000171 008D 26F8 BNE OUT010 ; TAKE 4 000172 008F 39 RTS 000173 0090 ; Inner loop 000174 0090 ; 000175 0090 ; Inner loop of nested loops. 000176 0090 ; 000177 0090 ; 77 min 77 max 0 stack 000178 0090 ; 000179 0090 INLOOP: 000180 0090 860A LDAA #10 000181 0092 IN010: 000182 0092 01 NOP 000183 0093 4A DECA 000184 0094 26FC BNE IN010 ; TAKE 9 000185 0096 39 RTS 66 TimeStack User's Guide Appendix A - Listing of Demo Program 000186 0097 ; Two loops 000187 0097 ; 000188 0097 ; Two loops in one. 000189 0097 ; 000190 0097 ; 436 min 436 max 0 stack 000191 0097 ; 000192 0097 TWOLOOP: 000193 0097 CE0005 LDX #5 000194 009A TWO010: 000195 009A 01 NOP 000196 009B 860A LDAA #10 000197 009D TWO020: 000198 009D 01 NOP 000199 009E 4A DECA 000200 009F 26FC BNE TWO020 ; TAKE 49 000201 00A1 ; 000202 00A1 09 DEX 000203 00A2 26F6 BNE TWO010 ; TAKE 4 000204 00A4 ; 000205 00A4 39 RTS 000206 00A5 ; Variable loops 000207 00A5 ; 000208 00A5 ; Different loop times 000209 00A5 ; 000210 00A5 ; 211 min 211 max 2 stack 000211 00A5 ; 000212 00A5 VARLOOP: 000213 00A5 8605 LDAA #5 000214 00A7 BD00B4 JSR DIFSUB ; 30 cycles 000215 00AA 860A LDAA #10 000216 00AC BD00B4 JSR DIFSUB ; 55 cycles 000217 00AF 8614 LDAA #20 000218 00B1 7E00B4 JMP DIFSUB 000219 00B4 ; 000220 00B4 DIFSUB: 000221 00B4 4A DECA 000222 00B5 26FD BNE DIFSUB ; TAKE 19 000223 00B7 39 RTS 67 TimeStack User's Guide Appendix A - Listing of Demo Program 000224 00B8 ; Stack Imbalance 000225 00B8 ; 000226 00B8 ; Stack may become imbalanced 000227 00B8 ; 000228 00B8 ; 10 min 13 max 1 stack 000229 00B8 ; 000230 00B8 STKIMB: 000231 00B8 01 NOP 000232 00B9 2601 BNE STK010 000233 00BB 36 PSHA 000234 00BC STK010: 000235 00BC 39 RTS 68 TimeStack User's Guide Appendix B - Warning and Error Messages Appendix B - Warning and Error Messages Warning Messages Warning messages indicate that everything is OK but that there may be something to watch out for or additional information is needed. A mismatch of the stack occurred A conditional branch has two possible paths, the path that results when the branch is taken and when it falls through. This indicates that the stack depth is different depending on which path is analyzed. It may be possible for the stack to become unbalanced depending on how the program works. Backwards branch or jump at address %x If a backwards branch or jump is encountered it is possible for a loop to exist. This gives the user the opportunity to review the program at this point to see if a loop is in progress. Branch at address %x was past the stop address A branch encountered during the analysis branched past the given stop address. The analysis results may not be valid because this branch has not been fully explored. It may also indicate that the stop address entered should be higher to do a full analysis. 69 TimeStack User's Guide Appendix B - Warning and Error Messages Indirect jump at address %x needs a destination The address that an indirect jump goes to is needed to complete the analysis. Indirect jump subroutine at address %x needs cycle time and stack depth An indirect jump subroutine must have the maximum number of clock cycles and maximum stack depth used by the intended subroutine. This is more versatile than entering an address to jump to. The specified stop address %x was never reached The stop address entered was not encountered during the analysis. This usually happens when the stop address entered is less than the start address. Another possibility is that a return from subroutine was encountered before the stop address entered and the logic flow did not allow it to reach the given stop address. Error Messages An error message terminates the function being done. It means some corrective action should be taken to fix the problem. Error list file is version %x The special node file being read in has a version number that does not match this version of TimeStack. Error opening configuration file %s for reading There is an error opening the given file for reading and writing. Error opening configuration file %s for writing The configuration file has an error while opening it for writing. Error opening print file %s for writing There is an error opening the given file for writing. 70 TimeStack User's Guide Appendix B - Warning and Error Messages Error reading configuration file header The first line of information in the configuration file is bad. This usually means the file is not a valid configuration file. Check the file name entered or the configuration file being used. Error with size of configuration file The configuration file is too large to be valid. Check to see that the given file is actually a configuration file. Error with the configuration version number The configuration file has a version that is greater then the program reading it. Use the correct version of TimeStack that matches the configuration file. Fatal internal error... An error occurred in the internal logic of TimeStack. This error should not occur in practice but is listed here for completeness. If this error persists, write down the details and contact BE, Inc. File error opening %s The file indicated was not found for the reason specified. Illegal opcode %x at address %x The opcode at this address is not a valid instruction for the current processor type. This might happen if a hex file for another processor is loaded, the wrong processor type was chosen, or an incorrect start address has been entered. One or both of the help files... One or both of the indicated help files is missing or can not be located by the TimeStack program. These files are first looked for in the current drive and directory. If they are not found there, each directory specified in the PATH environment variable is searched in turn until the files are found or the paths are exhausted. 71 TimeStack User's Guide Appendix B - Warning and Error Messages The address %x is not an address loaded The address encountered is not an address that was loaded from the hex file. Unless it is loaded from the hex file, the contents are undefined. The analysis is limited by the amount of free memory remaining The analysis is limited by the amount of memory in the system. Each jump subroutine and conditional branch encountered requires a little bit more. This usually means an infinite loop has been encountered or it may mean a loop that occurs more times than TimeStack can handle. The analysis is limited by the stack depth The analysis is limited by the amount of program stack in the system. This can not be changed by the user. Each jump subroutine and conditional branch encountered requires a little bit more. This usually means an infinite loop has been encountered. It may also mean a loop has been set up and is taken more times than TimeStack can handle. The branch at address %x is involved in a difficult structure Some loop structures are too difficult to analyze without some assistance. This is the branch that needs to be set for the loop in question. The file %s does not seem to be Motorola or Intel Hex format The letter S or a colon was not found to be the first character in the first line of the file. The file %s has a bad checksum The checksum in one of the records in the hex file is incorrect. The file %s had no hex information This file was scanned and identified as a Motorola or Intel hex file but no hex data was found after that. It probably is not a hex file at all. 72 TimeStack User's Guide Appendix B - Warning and Error Messages The number of steps to execute a series of instructions... A series of instructions with no conditional branch to divide it up has been encountered. This is probably an infinite loop. The opcode %x at address %x is not able to be analyzed for time The opcode at this address can not be logically analyzed. This is usually an instruction like halt the processor or wait for an interrupt to occur. The processor type found in the configuration file... The processor type found in the configuration file does not match any of the processors that this version of the TimeStack handles. The processor type information was not found... The configuration file must indicate what type of processor TimeStack should use. This information is missing. Virtual file error writing %s There was a problem writing to the temporary file created on the disk. The most likely reason is that the disk was full. The temporary files need at least 50K of space when TimeStack runs. 73 TimeStack User's Guide Appendix C - Key Summary Appendix C - Key Summary F1 Obtains context sensitive on-line help. F2 Edit address on top line of selected window. F3 Select next window. F4 Select previous window. F5 Reserved for future use. F6 Move and adjust selected window. ALT-A Analysis ALT-C Clear ALT-D Disasm ALT-E Edit ALT-F File ALT-L File | Load ALT-O Options ALT-P Print ALT-Q Quit 74 TimeStack User's Guide Appendix C - Key Summary ALT-R File | Restore ALT-S File | Save ALT-1 - ALT-6 Select the window with that number. Home Move to beginning of list in window or beginning of line. CTRL-Home Move to beginning of list in window. End Move to end of list in window or end of line. CTRL-End Move to end of list in window. Pg Up Move up one window's worth. Pg Dn Move down one window's worth. Cur Up Move up one line in window or pull down menu. CTRL-Pg Up Move up one line in window. Cur Dn Move down one line in window or pull down menu. CTRL-Pg Dn Move down one line in window. Ins Toggles insert mode when entering data. Del Deletes the character at the cursor position. Backspace Deletes the character just in front of the cursor. Cur Left Moves the cursor left one character. Cur Right Moves the cursor right one character. 75 TimeStack User's Guide Appendix D - Processor Specifics Appendix D - Processor Specifics TSDEMO The processor used for the demo program is based on a subset of the 68HC11 processor. The default clock divisor value is four. The following opcodes have been removed: * any instruction that requires a PREBYTE * all special instructions such as MUL, FDIV, IDIV * everything that operates on registers B, D, or Y 76 TimeStack User's Guide Appendix D - Processor Specifics TS6811 The default clock divisor value is four. 6800 The processors that fall in this category are: 6800. 6801 The processors that fall in this category are: 6801, 6801U4, 68701, 68701U4. 6802 This processor is identical to the 6800 for the purpose of analysis. It has a separate entry for labeling purposes. The processors included in this category are: 6802. 6803 These processors are identical to the 6801 for the purpose of analysis. It has a separate entry for labeling purposes. The processors that fall in this category are: 6803, 6803U4. 68HC11 The processors that fall in this category are: 68HC11A0, 68HC11A1, 68HC11A7, 68HC11A8, 68HC11D0, 68HC11D3, 68HC11E0, 68HC11E1, 68HC11E2, 68HC11E8, 68HC11E9, 68HC11F1, 68HC11L0, 68HC11L1, 68HC11L5, 68HC11L6, 68HC711D3, 68HC711E9, 68HC711K4, 68HC711J6, 68HC711L6. 77 TimeStack User's Guide Appendix D - Processor Specifics TS6805 There are a very large number of different 6805 variations but for timing purposes they fall into three categories. These are HMOS, HCMOS, and CMOS. If a specific processor has not been mentioned it should be obvious where it should be placed by looking at its number. 6805 HMOS The default clock divisor value is four. The HMOS processors that fall in this category are: 6805P2, 6805P6, 6805R2, 6805R3, 6805R6, 6805S2, 6805S3, 6805U2, 6805U3, 68705P3, 68705P5, 68705R3, 68705R5, 68705S3, 68705U3, 68705U5. 68HC05 HCMOS The default clock divisor value is two. The HCMOS processors that fall in this category are: 68HC05A6, 68HC05B4, 68HC05B6, 68HC05C2, 68HC05C3, 68HC05C4, 68HC05C5, 68HC05C8, 68HC05C9, 68HC05D9, 68HC05E0, 68HC05E1, 68HC05J1, 68HC05L6, 68HC05L7, 68HC05L9, 68HC05M4, 68HC05P1, 68HC05P4, 68HC05P7, 68HC05P8, 68HC05P9, 68HC05SC11, 68HC05SC21, 68HC05T1, 68HC05T2, 68HC05T7, 68HCL05C4, 68HCL05C8, 68HSC05C4, 68HSC05C8, 68HC705B5, 68HC705C8, 68HC705J2, 68HC705P9, 68HC805B6, 68HC805C4. 146805 CMOS The default clock divisor value is four. The CMOS processors that fall in this category are: 146805E2, 146805F2, 146805G2. 78 TimeStack User's Guide Appendix D - Processor Specifics TS8051 The default clock divisor value is twelve. The disassembler for this family of processors will show the internal register names and bits. 8051 The processors that fall in this category are: 8051, 8052, 8751. 8031 This processor is identical to the 8051 for the purpose of analysis. It has a separate entry for labeling purposes. The processors that fall in this category are: 8031, 8032. 79 TimeStack User's Guide Appendix D - Processor Specifics TS8048 The 8048 processors handle extended program memory in a special way. For programs of 2K bytes or less, program memory may be addressed in a conventional manner. Address above 2K can be reached by executing a program memory bank switch instruction (SEL MB0 or SEL MB1) followed by a branch instruction such as JMP or CALL. A bit called DBF (memory bank flip-flop) contains the setting of the last SEL MB0 or SEL MB1 instruction. All JMP's and CALL's use this bit to determine which memory bank (lower 2K or upper 2K) to execute from. The problem is when the analysis begins it is not known what state the DBF bit should be set to. This is handled by initially setting the DBF bit to match the memory bank of the start address given in the analysis. Another minor issue is that of indirect jumps. The range is limited to 256 bytes but the program will allow a 16-bit address to be entered. The stack depth of the 8048 processors allows a nesting level of eight. After that the stack pointer wraps around and the oldest return address is lost. The TimeStack analysis does not detect this. 8048 family The default clock divisor value is fifteen. The processors that fall in this category are: 8035, 8039, 8040, 8048, 8049, 8050, 8748, 8749. 8021/8020 The default clock divisor value is thirty. The processors that fall in this category are: 8021, 8020. 8022 The default clock divisor value is thirty. The processors that fall in this category are: 8022. 80 TimeStack User's Guide Index Index different processors, 27 Bytes memory usage, 45 - 6 - - C - 6800, 77 Clear, 16 6805, 78 Clock changing clock divisor, 17 6811, 77 changing rate, 16 cycles, 45 demo program, 37 - 8 - Command line 8048, 80 syntax, 7 8051, 79 Comment added to print, 18 - A - Complex loops, 48 Addresses, see also Start and Concepts stop timing, 31 entering, 12 Conditional branch Analysis, 14, see also Timing description, 31 demo program, 38 different processors, 27 window, 21 edit, 15 fall, 32 Assembly language, see Source forcing, 60 code inside subroutine, 39 normal, 32 Autoexec.bat, see take, 31 Configuration Configuration Automatically save autoexec.bat, 7 demo configuration, 37 automatically save, 17 demo program, 37 file, 14, 29 - B - get, 14 put, 14 BE, Inc. system requirements, 6 how to contact, 5 Cycles Branch clock, 45 past stop address, 58 Branch relative 81 TimeStack User's Guide Index - D - F5, Reserved for future use, 22 Demo program F6 - Move or size window, configuration, 37 23 invoking, 36 limitations, 27 processor specifics, 76 - H - DEMO.HEX, 36 Help on-line, 24 Disasm, 16 window, 20 Hex file, 13 description, 27 Intel, 28 - E - load, 13 load DEMO.HEX, 37 Edit, 15 Motorola, 28 conditional branch, 15 possible errors, 29 jump indirect, 16 jump to subroutine, 15 High level languages, 60 Error messages, 70 Hot keys Alt-1 - Alt-6, Select window, 23 - F - Alt-A, Analysis, 14, 23 Alt-C, Clear, 16, 23 Fall, see Conditional branch Alt-D, Disasm, 16, 23 Alt-E, Edit, 15, 23 File, 13, see also Node file Alt-F, File, 13, 23 get, 14 Alt-L, Load, 13, 23 load, 13 Alt-O, Options, 16, 23 put, 14 Alt-P, Print, 17, 23 restore, 13 Alt-Q, Quit, 19, 23 save, 13 Alt-R, Restore, 13, 23 Alt-S, Save, 13, 23 Filenames entering, 11 - I - Files, see also Configuration, see also Temporary files Illegal instructions, 51 Forcing Indirect jump, see also Jump conditional branches, 60 indirect, 50 Function keys Infinite loops, 57 F1, Help, 22 F2, Edit top item, 22, 60 Information F3, Select next window, 22 get summary, 37 F4, Select previous window, 22 Installation performing, 6 82 TimeStack User's Guide Index Instructions - L - illegal, 51 untimeable, 51 Languages, 60 Intel Limitations 8048, 80 demo program, 27 8051, 79 memory, 58 hex file, 28 Listing description, 29 - J - have it ready, 45 looking it over, 36 Jump different processors, 27 Loading DEMO.HEX, 37 Jump indirect, 35 TimeStack, 8 as return from subroutine, 35 Loops different processors, 27 complex, 48 edit, 16 description, 32 exit at bottom, 33, 41 Jump to subroutine exit in middle, 33, 42 different processors, 27 infinite, 57 edit, 15 inside other loops, 54 inside subroutines, 52 nested, 52 - K - Key - M - summary, 74 Maximum execution Keys, see also Function keys, strategy, 45 see also Hot keys window, 21 Backspace, 24 Ctrl-End, 24 Memory Ctrl-Home, 23 limitations, 58 Ctrl-Pg Dn, 24 Ctrl-Pg Up, 24 Menus, see also individual Cur Dn, 24 menu names Cur Left, 24 entering filenames, 11 Cur Right, 24 entering numbers, 12 Cur Up, 24 operation of, 10 Del, 24 screen layout, 9 End, 23 selections, 13 Home, 23 status line, 11 Ins, 24 Pg Dn, 24 Minimum execution Pg Up, 24 strategy, 45 window, 22 Mnemonics 83 TimeStack User's Guide Index differences, 26 path to printer, 18 results, 43, 60 Motorola 6800, 77 Processor 6805, 78 6800, 77 6811, 77 6805, 78 hex file, 28 6811, 77 8048, 80 8051, 79 - N - demo program type, 37, 76 display of type, 16 Node file, 13 automatically save, 17, 19 Program listing, see Listing description, 30 restore, 13 Program loops, see Loops save, 13 Program names, 7 Nodes clearing, 16 editing, 15 - Q - window, 20 Quit, 19, 44 Normal, see Conditional branch Numbers - R - bases, 12 entering, 12 README, 6 prefixes and postfixes, 12 Registration user registration, 5 - O - Relative branch, see Branch Options, 16 relative clock rate, 16 config, 17 Return from subroutine, see divisor for clock, 17 also Subroutine get, 17 different processors, 27 node, 17 stop address, 15 type of processor, 16 using jump indirect, 35 Running - P - TimeStack, 8 Prefixes and Postfixes entering numbers, 12 - S - Print, 17 Save comment, 18 results to file, 60 disasm to file, 18 disasm to printer, 18 Screen, see Menus or Windows path to file, 18 84 TimeStack User's Guide Index Simulator - T - comparison with TimeStack, 2 Take, see Conditional branch definition, 2 Temporary files, 30 Source code format, 25 TimeStack mnemonic differences, 26 benefits of using, 1 comparison with simulator, Special nodes 2 window, 20 loading and running, 8 program names, 7 Stack depth tutorial, 36 description, 35 imbalance, 56 Timing, see also Loops strategy, 45 concepts, 31 window, 22 indirect jump, 50 multiple paths, 47 Start address strategy, 45 examples, 39 subroutines, 55 Start and stop TPDEMO, 36, 48 description, 30 entering, 14 - U - Status line, 11 User registration, see Stop address Registration actual, 59 branch past, 58 examples, 39 - W - Strategy, see Timing Warning messages, 69 Subroutines Windows conditional branches, 39 analysis results, 21 description, 34 description, 19 different execution times, disassembly, 20 55 display of subroutines, 20 entering execution time, 34 maximum execution, 21 entering stack depth, 34 minimum execution, 22 indirect, 34 moving and sizing, 19 loops inside of, 52 screen layout, 9 return from, 34 selecting, 19 simple timing, 38 special nodes, 20 stack depth, 22 Syntax status line, 11 command line, 7 System requirements, 6 85